﻿using ConfExpert.Forms.Base;
using DevExpress.XtraEditors.Repository;
using DevTeam;

using System;
using System.Windows.Forms;

namespace ConfExpert.Forms.Depo.Aksesuar
{
    public partial class StokGirisOlustur : XForm
    {
        string Xml;
        int VendorId;
        public StokGirisOlustur(int VendorId,string Xml)
        {
            InitializeComponent();
            this.Xml = Xml;
            this.VendorId = VendorId;
        }

        private void StokGirisOlustur_Load(object sender, EventArgs e)
        {
            

            RepositoryItemGridLookUpEdit riBelgeTipi = GetCustomRI("BelgeTipi", false, "İrsaliye", "Fatura");
            gleBelgeTipi.Properties.Assign(riBelgeTipi);

            gleBelgeTipi.MakeCompulsory(lblBelgeTipi, "Doldurulması zorunlu alan");
            txtBelgeNo.MakeCompulsory(lblBelgeNo, "Doldurulması zorunlu alan");

            bbiGiris.ItemClick += bbiGiris_ItemClick;
        }

        void bbiGiris_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (ValidateAll())
            {
                string belgeTipi = gleBelgeTipi.EditValue.ToStr();
                string belgeNo = txtBelgeNo.EditValue.ToStr();

                ExecuteNonQuery("InsAksesuarGirisByPO", Xml, belgeTipi, belgeNo, VendorId, WhoAmI, txtNot.Text);
                this.DialogResult = DialogResult.OK;
            }

        }

    }
}